<?php
include( "config.php" );

$results = Result::getByEvent( $_POST['id'] );

echo( '<table width="100%">' );
    foreach ( $results['results'] as $result ) {
      echo( '<tr>' . "\n" .
            '<td width="40%">' . "\n" );
          if ( isset( $result->home_team ) ) {
            echo( htmlspecialchars( $result->home_team ) );
          }

        echo( '</td>' . "\n" .
              '<td width="10%">' . "\n" );
              
          if ( isset( $result->home_score ) ) {
            echo( htmlspecialchars( $result->home_score ) );
          }
          
        echo( '</td>' ."\n" .
              '<td width="10%">' . "\n" );

          if ( isset( $result->away_score ) ) {
            echo( htmlspecialchars( $result->away_score ) );
          }

        echo( '</td>' ."\n" .
              '<td align="right" width="40%">' . "\n");

          if ( isset( $result->away_team ) ) {
            echo( htmlspecialchars( $result->away_team ) );
          }

        echo( '</td>' . "\n" .
              '</tr>' . "\n" );
    }
echo( '</table>' );
?>
